using Ln.Fram.Core.RestSharp;
using Volo.Abp.ObjectMapping;

namespace Ln.Fram.Mapster;

public static class RestManagerExtensions
{
	public static RestManager AddHeader(this RestManager manager, IObjectMapper mapper, object obj)
	{
		Dictionary<string, string> dict = mapper.Map<object, Dictionary<string, string>>(obj);
		return manager.AddHeaders(dict.Keys.ToArray(), dict.Values.ToArray());
	}

	public static RestManager AddParameter(this RestManager manager, IObjectMapper mapper, object obj)
	{
		Dictionary<string, string> dict = mapper.Map<object, Dictionary<string, string>>(obj);
		return manager.AddParameters(dict.Keys.ToArray(), dict.Values.ToArray());
	}
}